package com.qipay.doc.service.impl;

import com.qipay.baas.model.ActionDoc;
import com.qipay.baas.model.ActionDocDetail;
import com.qipay.doc.service.ActionDocService;
import com.qipay.mapper.ActionDocDetailMapper;
import com.qipay.mapper.ActionDocMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ActionDocServiceImpl implements ActionDocService {

    @Autowired
    ActionDocMapper actionDocMapper;
    @Autowired
    ActionDocDetailMapper actionDocDetailMapper;

    @Override
    public int insertActionDoc(ActionDoc actionDoc) {
        return actionDocMapper.insert(actionDoc);
    }

    @Override
    public int updateActionDoc(ActionDoc actionDoc) {
        return actionDocMapper.updateByPrimaryKey(actionDoc);
    }

    @Override
    public ActionDoc selectActionDocByPK(int id) {
        return actionDocMapper.selectByPrimaryKey(id);
    }

    @Override
    public int deleteActionDoc(int id) {
        return actionDocMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<ActionDoc> selectActionDocByType(byte type) {
        return actionDocMapper.selectByType(type);
    }

    @Override
    public int insertActionDocDetail(ActionDocDetail actionDocDetail) {
        return actionDocDetailMapper.insert(actionDocDetail);
    }

    @Override
    public int updateActionDocDetail(ActionDocDetail actionDocDetail) {
        return actionDocDetailMapper.updateByPrimaryKeyWithBLOBs(actionDocDetail);
    }

    @Override
    public ActionDocDetail selectActionDocDetailByPK(int id) {
        return actionDocDetailMapper.selectByPrimaryKey(id);
    }

    @Override
    public int deleteActionDocDetail(int id) {
        return actionDocDetailMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<ActionDocDetail> selectActionDocDetailByDocId(int docId) {
        return actionDocDetailMapper.selectByDocId(docId);
    }

    @Override
    public List<ActionDocDetail> selectActionDocDetailByDocIdAndPid(int docId, int pid) {
        return actionDocDetailMapper.selectByDocIdAndPid(docId,pid);
    }

    @Override
    public List<ActionDocDetail> selectSmartActionDocDetailAll() {
        return actionDocDetailMapper.selectSmartAll();
    }

}
